
package jweslley.ProblemSetVolumes.VolumeV;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;

import jweslley.Problem;
import jweslley.Problem.Status;

/**
 * http://icpcres.ecs.baylor.edu/onlinejudge/external/5/579.html
 *
 * @author  Jonhnny Weslley
 * @version 1.00, 16/10/2008
 */
@Problem(Status.Accepted)
public class ClockHands {

	public static void main(String[] args) throws IOException {
		DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance();
		symbols.setDecimalSeparator('.');
		NumberFormat format = new DecimalFormat("##0.000", symbols);
		StringBuilder out = new StringBuilder();
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		double a;
		int h, min;
		String time[];
		for (String line = in.readLine();
			line != null && !line.equals("0:00");
			line = in.readLine()) {
			time = line.split(":");

			h = Integer.valueOf(time[0]);
			min = Integer.valueOf(time[1]);

			a = 30*h - (11*min)/2D;
			if (a < 0) { a = -a; }
			if (a > 180) { a = 360 - a; }

			out
			.append(format.format(a))
			.append('\n');
		}
		System.out.print(out);
	}

}
